package settings;

import java.io.File;

import fileHandling.language.options.Common;

import logic.nodes.nodeSettings.Settings;

public class CommonSettings extends ConfigFile {
	
	public static final int INSTALLED_MOUSE_CURSORS = getInstalledMouseCursors();
	
	private static CommonSettings settings = new CommonSettings();
	
	private CommonSettings() {
		super();
	}
	
	private static int getInstalledMouseCursors() {
		File file = new File("data/textures/gui/cursors/");
		int cursors = 0;
		for(File subFile : file.listFiles()) {
			if(subFile.getName().startsWith("ingame")) cursors++;
		}
		return cursors;
	}
	
	public static CommonSettings get() { return settings; }
	
	@Override
	public void reset() { settings = new CommonSettings(); }
	
	@Override
	public String getFileName() { return "common.xml"; }
	
	@Override
	protected Settings getSettings() { return settings; }
	
	public void setFOV(String fov) { addOption(Common.FOV, fov); }
	public int getFOV() { return Integer.valueOf(getFOVString()).intValue(); }
	public String getFOVString() { return getValueOf(Common.FOV); }
	
	public void setDrawFPS(String fps) { addOption(Common.Draw_FPS, fps); }
	public boolean getDrawFPS() { return Boolean.valueOf(getDrawFPSString()).booleanValue(); }
	public String getDrawFPSString() { return getValueOf(Common.Draw_FPS); }
	
	public void setLanguage(String language) { addOption(Common.Language, language); }
	public String getLanguageString() { return getValueOf(Common.Language); }
	
	public void setCrosshairType(String type) { addOption(Common.Crosshair_Type, type); }
	public String getCrosshairTypeString() { return getValueOf(Common.Crosshair_Type); }
	public int getCrosshairType() { return Integer.valueOf(getCrosshairTypeString()).intValue(); }
	
	public void setCrosshairColorRed(String red) { addOption(Common.Crosshair_Color_R, red); }
	public String getCrosshairColorRedString() { return getValueOf(Common.Crosshair_Color_R); }
	public float getCrosshairColorRed() { return Float.valueOf(getCrosshairColorRedString()).floatValue(); }
	
	public void setCrosshairColorGreen(String green) { addOption(Common.Crosshair_Color_G, green); }
	public String getCrosshairColorGreenString() { return getValueOf(Common.Crosshair_Color_G); }
	public float getCrosshairColorGreen() { return Float.valueOf(getCrosshairColorGreenString()).floatValue(); }
	
	public void setCrosshairColorBlue(String blue) { addOption(Common.Crosshair_Color_B, blue); }
	public String getCrosshairColorBlueString() { return getValueOf(Common.Crosshair_Color_B); }
	public float getCrosshairColorBlue() { return Float.valueOf(getCrosshairColorBlueString()).floatValue(); }
	
	public void setCrosshairColorAlpha(String alpha) { addOption(Common.Crosshair_Color_A, alpha); }
	public String getCrosshairColorAlphaString() { return getValueOf(Common.Crosshair_Color_A); }
	public float getCrosshairColorAlpha() { return Float.valueOf(getCrosshairColorAlphaString()).floatValue(); }
	
	public String getCrosshairSizeString() { return getValueOf(Common.Crosshair_Size); }
	public float getCrosshairSize() { return Float.valueOf(getCrosshairSizeString()).floatValue(); }
	
	public boolean showHunter() { return Boolean.valueOf(getValueOf(Common.show_hunter)).booleanValue(); }
}